#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>
#include <assert.h>

void* My_memmove(void* sur, void* dest, size_t num)
{
	assert(sur && dest);
	void* ret = dest;
	if (dest > sur)	
	{
		while (num--)
		{
			*(char*)sur = *(char*)dest;
			dest = (char*)dest + 1;
			sur = (char*)sur + 1;
		}
	}
	else
	{
		while (num--)
		{
			*((char*)sur + num) = *((char*)dest + num);
		}
	}
	return ret;
}

int main()
{
	int arr1[10] = { 1,2,3,4,5,6,7,8,9,10 };
	My_memmove(arr1, arr1 + 2, 20);
	for (int i = 0; i < 10; i++)
	{
		printf("%d ", arr1[i]);
	}
	return 0;
}

